'use strict'

module.exports = angular.module 'services.base', []
.factory 'BaseService', ($log, $q)->
  $log.log "base service init"
  class BaseService
    constructor: ->

    deal: (promise, successCb, errorCb)->
      return if !promise or !successCb
      promise.then (response)->
        successCb(response)
      , (response)->
        return errorCb(response) if errorCb
        return $q.reject response